package com.kitty.game.difu.service;

import com.kitty.common.utils.SpringUtils;
import com.kitty.game.config.NPC;
import com.kitty.game.enter.RespGeneralNotify;
import com.kitty.game.role.model.Role;
import com.kitty.mina.message.MessagePusher;
import org.springframework.stereotype.Service;

@Service
public class Call_GuiChongService {
    public synchronized void callChongWu(Role role, String msg, NPC npc) {
        if (role.getLevel() < 75) {
            sendNpcContent(role, npc, "请修炼到75级，再来召唤！[离开]");
            return;
        }
        sendNotify(role,97, "GhostPetCallDlg");
    }
    public void sendNpcContent(Role role, NPC bossNpc, String content) {
        SpringUtils.getNpcService().sendNpcContent(role, bossNpc, content);
        // 这里会覆盖掉content的内容，而是继续显示原有NPC的内容。此行注释，有bug
        // SpringUtils.getNpcService().sendPurNpcContent(role, bossNpc, content);
    }
    /**
     * 关闭投票
     */
    private void sendNotify(Role role,int id,String type) {
        RespGeneralNotify respGeneralNotify = new RespGeneralNotify();
        respGeneralNotify.setNotify(id); //关闭对话框
        respGeneralNotify.setValue("GhostPetCallDlg");
        MessagePusher.pushMessage(role, respGeneralNotify);
    }

}
